/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.fatec.ppi.teste;


import br.fatec.ppi.modelo.Aluno;
import java.util.List;
import java.util.Scanner;
import javax.persistence.Query;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;


public class MainQuery {
   
    public static void main(String [] args){
    
 
   
     
   EntityManagerFactory fabricaMotores = Persistence.createEntityManagerFactory("modelo");

   EntityManager motor = fabricaMotores.createEntityManager();
    EntityTransaction transacao= motor.getTransaction();
    
     Query pesquisa = motor.createQuery("select c.nome from Aluno c where c.nome like '%ria%' ");
     
     List<String> listaAlunos = pesquisa.getResultList();
     
     for(String alunoTmp : listaAlunos){
        System.out.println("Nome: "+alunoTmp);
     } 
}
}

